﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LightCube
{
    public struct Point3D
    {
        public int X;
        public int Y;
        public int Z;

        public static Point3D Zero = new Point3D { X = 0, Y = 0, Z = 0 };

        public Point3D(int x, int y, int z)
        {
            X = x;
            Y = y;
            Z = z;
        }

        public bool OutOfBound(int size)
        {
            return X > size || Y > size || Z > size;
        }

        public Point3D Offset(Point3D offset)
        {
            return new Point3D { X = X + offset.X, Y = Y + offset.Y, Z = Z + offset.Z };
        }

        public Point3D Wrap(int size)
        {
            return new Point3D { X = X & size, Y = Y % size, Z = Z % size };
        }
    }
}
